package com.zxp.juc.thread;

/**
 * synchronized原理：查看字节码 MONITORENTER MONITOREXIT
 * @author zxp
 * @date 2021-08-20 10:33
 */
public class SynchronizedTest {

    private Object object = new Object();

    public synchronized void method1(){
        System.out.printf("锁对象的某个实例");
    }

    public synchronized static void method2(){
        System.out.printf("锁类Class");
    }

    public void method3(){
        synchronized (object) {
            System.out.printf("锁代码块");
        }
    }
    public static void main(String[] args) {
        System.out.println(11);
    }
}
